<extend name="Public:base"/>

<!--侧边导航-->
<block name="aside">
    <include file="Public:aside"/>
</block>

<block name="main">


    <form id="myform" action="{:U('Form/insert')}" method="post" class="form-horizontal">
        <div class="form-group">
            <label class="control-label col-md-2"><font color="red">*</font>名称</label>
            <div class="col-md-5">
                <input type="text" class="form-control" name="name" />
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2"><font color="red">*</font>表名称</label>
            <div class="col-md-5">
                <input type="text" class="form-control" name="tablename"/>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2"><font color="red">*</font>验证码</label>
            <div class="col-md-5">
                <label class="radio-inline">
                    <input type="radio" name="captcha" checked="checked" value="1"/>开启
                </label>
                <label class="radio-inline">
                    <input type="radio" name="captcha" value="0"/>关闭
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2"><font color="red">*</font>是否发送的邮箱</label>
            <div class="col-md-5">
                <label class="radio-inline">
                    <input type="radio" name="sendmail" value="1"/>是
                </label>
                <label class="radio-inline">
                    <input type="radio" name="sendmail" checked="checked" value="0"/>否
                </label>
                <br/>
                <label>发送的邮箱配置中的接受邮箱</label>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">列表页调用字段</label>
            <div class="col-md-5">
                <input type="text" id="listfields" class="form-control" name="listfields"  class="form-control" value="<if condition="empty($vo['listfields'])">*<else />{$vo.listfields}</if>" /> 例:id,title,url,catid
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-2">表简介</label>
            <div class="col-md-5">
                <textarea id="description" class="form-control" name="description" rows=4"" cols="55">{$vo.description}</textarea>
            </div>
        </div>
        <div class="form-actions">
            <input type="hidden" name="type" value="1">
            <input type="submit" value="提交" class="btn btn-sm btn-primary" />
            <input type="reset" value="{:L('cancel')}" class="btn btn-sm btn-primary"/>
        </div>
    </form>
</block>


<block name="script">
    <script type="text/javascript">
        $(document).ready(function() {
            $('#myform').ajaxForm({
                success:  complete,  // post-submit callback
                dataType: 'json'
            });
        });

        function complete(data){
            if (data.status == 1) {
                layer.msg(data.info, {
                    icon: 1,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                }, function(){
                    window.location.href = "{$Think.cookie.__forward__}";
                    return true;
                });
            } else {
                layer.msg(data.info, {
                    icon: 2,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                });
            }
        }
    </script>
</block>